package cn.dengta.webapp.im.entity;

import java.util.Date;

import cn.dengta.context.model.WesKit;
import cn.dengta.webapp.base.entity.TimeBasedEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;

/**
 * Ai文字聊天记录
 *
 * @author zxy
 * @since 2024-04-26
 */
@Setter
@Getter
@TableName("im_ai_msg_log")
public class AiMsgLog extends TimeBasedEntity {

	private static final long serialVersionUID = 1L;

	/** 消息发送者（用户或者Ai标识） */
	Long fromId;
	/** 消息接受者 （用户或者Ai标识） */
	Long toId;
	/** 1=fromId为用户id；2=fromId为Ai标识 */
	Integer fromType;
	/** 业务类型：0=Ai语音对话；1=Ai文字聊天 */
	Integer busType;
	/** 消息类型 */
	String msgType;
	/** 发送内容 */
	String body;
	/** 回复 */
	String reply;
	/** 附加信息 */
	String attach;
	/** 扩展数据 */
	String ext;
	/** 速配ID */
	Long speedId;
	/** 消息发送方的客户端IP地址(仅SDK发送的消息才有该字段) */
	String ip;
	/** 消息发送时间 */
	Date sendTime;
	/** 分包标识 */
	WesKit wesKit;

	public AiMsgLog init(WesKit wesKit, Long fromId, Long toId, Integer fromType) {
		this.wesKit = wesKit;
		this.fromId = fromId;
		this.toId = toId;
		this.fromType = fromType;
		return this;
	}

	public static final String FROM_ID = "from_id";
	public static final String TO_ID = "to_id";
	public static final String FROM_TYPE = "from_type";
	public static final String MSG_TYPE = "msg_type";
	public static final String BODY = "body";
	public static final String ATTACH = "attach";
	public static final String EXT = "ext";
	public static final String SPEED_ID = "speed_id";
	public static final String IP = "ip";
	public static final String SEND_TIME = "send_time";

}
